package com.mingtang.online.adapter;

import android.content.Intent;
import android.graphics.Paint;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtang.online.R;
import com.mingtang.online.activity.HongBaoWebActivity;
import com.mingtang.online.activity.ShopDetailActivity;
import com.mingtang.online.bean.ShangPin;

import java.util.List;

/**
 * 文 件 名: NewsListAdapter
 * 创 建 人: zhangyu
 * 创建日期: 16/12/24 19:55
 * 邮   箱: yuanchong121@gmail.com
 * 修改时间：
 * 修改备注：
 */
public class IndexAdapter extends BaseQuickAdapter<ShangPin.ContentBean, BaseViewHolder> {

    List<String> data;

    public IndexAdapter(List<ShangPin.ContentBean> data) {

        super(R.layout.item_index, data);
    }

TextView text_old;
    @Override
    protected void convert(BaseViewHolder helper, final ShangPin.ContentBean item) {

        helper.setText(R.id.text_zhi, item.getItemtitle());
        Glide.with(mContext).load(item.getItempic()).error(R.mipmap.logo).placeholder(R.mipmap.logo).into((ImageView) helper.getView(R.id.img_tupian));

        helper.setOnClickListener(R.id.lyaout_index, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                intent = new Intent(getActivity(), HongBaoWebActivity.class);
                Intent intent = new Intent(mContext, ShopDetailActivity.class);
                intent.putExtra("itemid", item.getItemid());

                mContext.startActivity(intent);
            }
        });

        helper.setText(R.id.text_new, "¥"+item.getItemendprice());
        text_old=helper.getView(R.id.text_old);
        text_old.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );
        helper.setText(R.id.text_old, "¥"+item.getItemprice());
        helper.setText(R.id.text_right, item.getTktype());

    }


}
